package com.onesports.intelligent.k12.polarlight.security;

import org.springframework.security.core.Authentication;

/**
 * @author aj
 */
public interface TokenProvider {
    /**
     * 生成token
     *
     * @param authentication
     * @param prefix
     * @param rememberMe
     * @return
     */
    String createToken(Authentication authentication, String prefix, boolean rememberMe);

    /**
     * token续期
     *
     * @param token
     * @return
     */
    Boolean refreshExpiration(String token, String loginUserId);

    /**
     * 根据token获取认证信息
     *
     * @param token
     * @return
     */
    Authentication getAuthentication(String token);

    /**
     * 校验token有效性
     *
     * @param authToken
     * @return
     */
    boolean validateToken(String authToken);
}
